<?php
	$MaHocSinh =  $_POST['MaHocSinh'];
	$HocKy = $_POST['HocKy'];
	$NamHoc = $_POST['NamHoc'];
	$MaMonHoc = $_POST['MaMonHoc'];
	
	$DiemThi = $_POST['DiemThi'] ;
	

	$diemhk = new diemhkbs();
	
	$diemhk->MaHocSinh = $MaHocSinh;
	$diemhk->MaMonHoc = $MaMonHoc;
	$diemhk->HocKy = $HocKy;
	$diemhk->NamHoc = $NamHoc;
	$danhsach = $diemhk->GetList();
	$DiemTB = round(DTBMH_HK($danhsach[0]['KiemTra_Mot'],$danhsach[0]['KiemTra_Hai'],$DiemThi),2);

		$diemthilai = new diemthilaibs();
		$diemthilai->MaHocSinh = $MaHocSinh;
		$diemthilai->MaMonHoc = $MaMonHoc;
		$diemthilai->HocKy = $HocKy;
		$diemthilai->NamHoc = $NamHoc;
		$diemthilai->DiemThi = $DiemThi;
		$diemthilai->DiemTB = $DiemTB;
		$kq = $diemthilai->Update();
		
		if ($kq)
			header("Location: hocsinh-diemhk-". $MaHocSinh."");
		else
			ThongBaoLoi("Lỗi truy vấn!");

?>